<template>
	<view class="content">

		<view class="placeholding"></view>
		<view class="box" v-if="pageIndex === '0'">
			<image src="../../../static/navigation/24gl-ellipsis.png" />
			<text>{{ msg }}</text>
			<image src="../../../static/navigation/add.png" @click="showTip" />
		</view>
		<view class="box" v-if="pageIndex === '1'">
			<view class="placeholding-icons"></view>
			<text>{{ '聊天' }}</text>
			<image src="../../../static/navigation/add.png" @click="showTip" />
		</view>


		<uv-overlay :show="showChoices" @click="showChoices = false" opacity=0 duration=100>
			<view class="choices" @tap.stop>
				<view>
					<image src="../../../static/navigation/chat.png" />
					<text>发起群聊</text>
				</view>
				<view>
					<image src="/static/navigation/Friends.png" />
					<text>添加朋友</text>
				</view>
				<view @click="scanCode">
					<image src="../../../static/navigation/ScanCode.png" />
					<text>扫一扫</text>
				</view>
				<view style="border: none;">
					<image src="../../../static/navigation/pay.png" />
					<text>收付款</text>
				</view>
			</view>
		</uv-overlay>
	</view>
</template>

<script>
	export default {
		props: {
			pageIndex: {
				type: String,
				default: '0'
			}
		},
		data() {
			return {
				msg: 'WeChat(0)',
				showChoices: false,
			}
		},
		methods: {
			showTip() {
				this.showChoices = !this.showChoices;
			},
			jumpPage(page) {
				this.showChoices = !this.showChoices;
				uni.navigateTo({
					url: page,
					animationType: 'pop-in',
					animationDuration: 200
				});
			},
			scanCode() {
				this.showTip();
				uni.scanCode({
					success: (res) => {
						console.log(res.result);
						uni.setStorageSync('web', res.result);
						uni.navigateTo({
							url: '/pages/Webpages/Webpages'
						})
					},
					fail: (err) => {
						console.log('扫码失败', err);
					}
				});
			}
		},
		mounted() {

		}
	}
</script>

<style>
	@import "./navigation.css";
</style>